package flex.cc.order.manage.controller;

import com.alibaba.fastjson.JSON;
import flex.cc.core.support.BaseController;
import flex.cc.order.manage.service.InputOrderService;
import flex.cc.wrapper.WrapMapper;
import flex.cc.wrapper.Wrapper;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 手工单录入
 */
@RestController
@RequestMapping(value = "/order/input")
public class InputOrderController extends BaseController {

    @Autowired
    private InputOrderService inputOrderService;

    @PostMapping(value = "/commit")
    @ResponseBody
    @ApiOperation(httpMethod = "POST", value = "手工单提交")
    public Wrapper<String> commit(@ApiParam(name = "reqVo", value = "请求信息") @RequestBody Map<String, Object> reqVo) {
        logger.info("InputOrderController -- commit() ====> ", reqVo);
//        reqVo = inputOrderService.commit(reqVo);
        reqVo = inputOrderService.commit_V2(reqVo);
        return WrapMapper.ok(JSON.toJSONString(reqVo));
    }

}
